MAVLink: refine reconnect STATUSTEXT (per-peer tracking, snapshot rate limit) - #11731
MAVLink: refine reconnect STATUSTEXT (per-peer tracking, snapshot rate limit)#11731xznhj8129 wants to merge 7 commits into
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
- MAV_CMD_COMPONENT_ARM_DISARM and MSP2_INAV_ARM_DISARM through the normal arming path, succeeding only when the requested state is reached - RTH via a temporary BOXNAVRTH source on the RC mode selector (activateRTHMode) instead of the failsafe/geozone forced-RTH latch; wired to MAV_CMD_NAV_RETURN_TO_LAUNCH, ArduPilot DO_SET_MODE RTL, MSP2_INAV_ACTIVATE_RTH, and Programming Framework operation 61. Cleared by a pilot flight-mode change or disarm - QGC/ArduPilot pause: DO_SET_MODE Loiter/PosHold/Brake enters normal PosHold at the current position via a temporary BOXNAVPOSHOLD source - Normal current-position LAND (transient waypoint, uploaded mission untouched) via MAV_CMD_NAV_LAND, MSP2_INAV_ACTIVATE_LANDING, PF op 62 - MAV_CMD_DO_SET_HOME through the native waypoint-0 backend - MSP2_INAV_TIMESYNC returning the MAVLink TIMESYNC boot clock - Temporary fixed-wing loiter-radius override: DO_REPOSITION.param3 (meters) or int32 loiterRadius appended to MSP2_INAV_SET_GLOBAL_TARGET (cm); volatile, cleared on disarm/reboot, only active in PosHold - SET_POSITION_TARGET_GLOBAL_INT / _LOCAL_NED guided handling - MAV_CMD_CONDITION_YAW; explicit unsupported MAV_CMD_NAV_TAKEOFF stub - GCSN OSD flight-mode element while GCS navigation is active Unit slice: 81/81 passing.
A command-triggered landing (MAV_CMD_NAV_LAND / MSP direct land) borrows NAV_STATE_WAYPOINT_RTH_LAND and the FW autoland FSM with a transient waypoint, while activeWaypointIndex still points at whatever mission item was last active. The unconditional reached-marking added for mission LAND items would emit MISSION_ITEM_REACHED for that stale index and could mark a loaded mission complete. Capture forcedLandingActivated before the existing clears and skip the marking for commanded landings at both finish sites.
MSP transport over MAVLink TUNNEL (private payload type 0x8001, MAVLink 2 only) so the Configurator can talk MSP over an existing MAVLink telemetry link. Reuses the MSP parser/encoder through narrow msp_serial seams; replies are fragmented and returned on the ingress port only; MSPv1/v2 framing symmetry is preserved end-to-end. Reboot post-processing is allowed; serial passthrough and ESC 4-way are rejected before dispatch. Malformed payload lengths are dropped and stale partial frames time out. Reply/frame buffers are file-scope, not task stack. Companion configurator branch adds the MAVLink Tunnel wireless option. Full mavlink_unittest suite: 86/86 passing. Final PR of the mavlink_multiport2 stack: tree now matches the feature branch (remaining deltas are upstream maintenance-10.x drift only).
docs/Mavlink.md documents the full MAVLink stack: multiport + routing,
datastream groups and CLI settings, identity/capabilities, mLRS
integration, supported outgoing/incoming messages and commands, mode
mappings, mission behavior and MSP parity gaps, MSP-over-MAVLink
tunnel, and high-latency mode. Updated from the development branch to
cover flight-mode-change STATUSTEXT notices and reworded for mainline.
docs/Settings.md regenerated from settings.yaml (picks up the per-port
mavlink_port{1-4}_* settings).
End-to-end live harness against a running SITL/FC MAVLink endpoint: API version, FC variant/version, build info, EEPROM write, reboot over the tunnel, and reconnect recovery after reboot.
- Document per-peer reconnect STATUSTEXT/arming re-announcement - Fix STATUSTEXT severity: arming-disable and mode notices are NOTICE only - Correct MSP-parity LAND/RTH rows: leg speed and RTH land flag are captured on upload, dropped on download - Restrict stream-rate CLI settings to port 1 (ports 2-4 have none) - Complete upload-translator list (RTH/SET_POI/SET_HEAD) and DO_REPOSITION param4 heading - Note downloads always reply MISSION_ITEM_INT - Fix dead MSP-Navigation-Messages.md link -> Navigation.md wp section
Review feedback on the reconnect STATUSTEXT commit: - Track heartbeat presence per peer in the route table instead of one timestamp per port, so a steady peer cannot mask a newly joining one behind the same port, and a peer failing over to another port registers as a reconnect there. If the route table is full the new peer degrades to broadcast-only behavior. - Rate-limit arming snapshots per port so a peer heartbeating slower than the gap threshold cannot elicit a resend on every beat. - Drop the enable-transition snapshot: it fired into a port nobody had connected to yet (boot) and duplicated the first-heartbeat snapshot on shared-port enable. Reconnect is now driven purely by the heartbeat signal; the enable transition still resets per-port one-shot state via the port reset path.
76e8e3e to
9a4d419
Compare
|
Went through this one closely since it's specifically about reliability of the arming-state notification — a couple of things I noticed that both seem to reproduce the same class of issue this PR is fixing, wanted to check my understanding: Route-table-full peers get no notification at all, not "broadcast-only" fallback The new per-port snapshot floor can suppress a second peer's first-ever snapshot Removing the enable-transition Not trying to block on all of these — mostly want to understand whether the route-table-full and shared-floor cases are known/acceptable tradeoffs before flagging them as gaps. The per-peer keying itself (the core fix for the steady-peer-masking-a-new-one bug) looks correct and clean, and the millis()-wraparound-safe comparisons and the |
Follow-up to the reconnect STATUSTEXT handling merged in #11715, addressing review feedback on the reconnect-detection design.
The original commit tracked heartbeat presence with a single timestamp per physical port and sent an arming-reason snapshot on every judged reconnect. Review raised two soundness issues with that:
Changes
sysid/compid), not per port. A steady peer no longer masks a new one; a peer moving to another port registers as a reconnect there. If the route table is full the new peer degrades gracefully to the pre-existing broadcast-only behaviour.Testing
mavlink_unittest38/38 at this level (no new unit tests — behaviour is timing/multi-peer and covered by the live rig below).Built on the
mav/04-streams-protocolcontent already inmaintenance-10.xvia #11715, so this shows a single commit.